package com.vr.xuecheng.feign.client;

import com.vr.xuecheng.feign.config.FeignMultipartSupportConfig;
import com.vr.xuecheng.feign.response.Result;
import com.vr.xuecheng.feign.fallback.MediaFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author hzh
 * @date 2025/03/21
 * 媒资管理的feign接口
 */
@FeignClient(
        name = "xuecheng-plus-media-service",
        path = "/media",
        fallbackFactory = MediaFallbackFactory.class,
        configuration = FeignMultipartSupportConfig.class,
        contextId = "mediaClient"
)
public interface MediaClient {
    @PostMapping(value = "/upload/course-html-file", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    Result<String> upload(@RequestPart("file") MultipartFile file, @RequestParam("objectName") String objectName);

    @GetMapping("/get-info/{media-id}")
    Result<String> getFilePathById(@PathVariable("media-id") String mediaId);
}
